<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// 
//  admin_cache.php
//  www.6block.com
//  
//  Created by Will_Lee on 2011-06-08.
//  Copyright 2011 lishuzu. All rights reserved.
// 
class Admin_cache extends CI_Controller {

	 function __construct()
	 {
		parent::__construct();
 		$this->load->model('common/security_model');
		if($this->security_model->isAdminLogin() === FALSE){
          showmessage('请登录', 'admin/login/index', 3);
		}
		//加载缓存类
		$this->load->library('datacache');
		
	 }

	function index()
	{
		$data = array();
		if ($this->input->post('cachesubmit')) {
			$cachetype = $this->input->post('cachetype');
			if (is_array($cachetype)) {
				//系统缓存
				if(empty($cachetype) || in_array('database', $cachetype)) {
					$this->datacache->config_cache();
					// 用户组缓存
					$this->datacache->usergroup_cache();
					//tag缓存
					$this->datacache->tag_cache();
					//统计缓存
					$this->datacache->statistics();
				}

				//模板缓存
				if(empty($cachetype) || in_array('tpl', $cachetype)) {
					tpl_cache();
				}

				//块数据缓存
				if(empty($cachetype) || in_array('block', $cachetype)) {
					//主页缓存
					$this->datacache->index_cache();
				}

				//其他缓存
				if(empty($cachetype) || in_array('network', $cachetype)) {
					
				}
				showmessage('操作成功','admin/admin_cache', 2);
			}
		}
		$this->load->template('admin/cache_tpl', $data);
	}
}
?>